Do not depend on GLib API introduced after 2.66
authorEmmanuele Bassi <ebassi@gnome.org>
Mon, 23 Nov 2020 12:02:21 +0000 (12:02 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 23 Nov 2020 12:06:22 +0000 (12:06 +0000)
To avoid bleeding edge deprecations we use GLIB_VERSION_MIN_REQUIRED and
GLIB_VERSION_MAX_ALLOWED. Since we depend on GLib 2.66, we cannot use
API introduced in 2.67, even when conditionally compiled.

gtk/tools/gtk-builder-tool.c

index e45a52672d1b99f842ac668a5f25c5870ea74cb7..bc8920704917bfe01e309915d13e0ec04c9c4c73 100644 (file)
@@ -52,16 +52,17 @@ usage (void)
   exit (1);
 }
 
-#if !GLIB_CHECK_VERSION(2,67,0)
+/* A simplified version of g_log_writer_default_would_drop(), to avoid
+ * bumping up the required version of GLib to 2.68
+ */
 static gboolean
-g_log_writer_default_would_drop (GLogLevelFlags  level,
-                                 const char     *domain)
+would_drop (GLogLevelFlags  level,
+            const char     *domain)
 {
   return (level & (G_LOG_LEVEL_ERROR |
                    G_LOG_LEVEL_CRITICAL |
                    G_LOG_LEVEL_WARNING)) == 0;
 }
-#endif
 
 static GLogWriterOutput
 log_writer_func (GLogLevelFlags   level,
@@ -81,7 +82,7 @@ log_writer_func (GLogLevelFlags   level,
         message = fields[i].value;
     }
 
-  if (message != NULL && !g_log_writer_default_would_drop (level, domain))
+  if (message != NULL && !would_drop (level, domain))
     {
       const char *prefix;
       switch (level & G_LOG_LEVEL_MASK)